﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Aandelendelen.Obs
{
	public class Calculator
	{
		public static decimal GetCommission(decimal amount)
		{
			/*
			 * Calculates monthly commission in euros, based on 0,2% annually.
			 * The accurate percentage is 1.00016681964 (0.016681964%)
			 */
			decimal commission = Math.Round((decimal)(0.00017) * amount + (decimal)0.005, 2);

			return commission;
		}

		public static double GetCommission(double amount)
		{
			/*
			 * Calculates monthly commission in stocks with four decimal places, based on 0,2% annually.
			 * The accurate percentage is 1.00016681964 (0.016681964%)
			 */
			double commission = Math.Round((double)(0.00017) * amount + (double)0.00005, 4);

			return commission;
		}

		public static decimal GetPayPalPrice(decimal amount)
		{
			decimal paypalPrice = Math.Round((decimal)(1.0352) * amount + (decimal)0.37 + (decimal)0.005, 2);

			return paypalPrice;
		}

		public static decimal GetProfitPercentage(decimal buy, decimal current)
		{
			return 100 * (current - buy) / buy;
		}
	}
}